package com.gscitysfy.cus.drain.modules.reserveplan.controller;


import com.gscitysfy.cloudfrmwk.assistant.domain.Result;
import com.gscitysfy.cus.drain.modules.reserveplan.entity.DrainReservePlanMnMaterial;
import com.gscitysfy.cus.drain.modules.reserveplan.entity.DrainReservePlanMnTeam;
import com.gscitysfy.cus.drain.modules.reserveplan.service.IDrainReservePlanMnTeamService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 预案对应四个等级的应急队伍 前端控制器
 * </p>
 *
 * @author shenglin
 * @since 2022-11-15 14:28:05
 */
@RestController
@RequestMapping("/reserveplan/drain-reserve-plan-mn-team")
@Tag(name = "预案管理-应急队伍")
public class DrainReservePlanMnTeamController {

    @Autowired
    IDrainReservePlanMnTeamService drainReservePlanMnTeamService;

    /**
     * 新增预案应急队伍
     *
     * @param drainReservePlanMnTeams
     * @return
     */
    @PostMapping("/saveReservePlanMnTeam")
    @Operation(summary = "新增预案应急队伍", description = "新增预案应急队伍")
    public Result saveReservePlanMnTeam(@RequestBody List<DrainReservePlanMnTeam> drainReservePlanMnTeams) {
        return Result.content(drainReservePlanMnTeamService.saveBathReservePlanMnTeamInfo(drainReservePlanMnTeams));
    }


    /**
     * 获取案应急队伍
     *
     * @param infoId
     * @return
     */
    @PostMapping("/getReservePlanMnTeam")
    @Operation(summary = "获取预案应急队伍列表", description = "获取预案应急队伍列表")
    @Parameters({
            @Parameter(required = true, name = "infoId", description = "预案id"),
    })
    public Result getReservePlanMnTeam(String infoId) {
        return Result.content(drainReservePlanMnTeamService.getReservePlanMnTeamInfoList(infoId,null));
    }

    /**
     * 根据预案等级获取获取案应急队伍
     *
     * @param infoId
     * @return
     */
    @PostMapping("/getReservePlanMnTeamByLevel")
    @Operation(summary = "根据预案等级获取获取案应急队伍", description = "根据预案等级获取获取案应急队伍")
    @Parameters({
            @Parameter(required = true, name = "infoId", description = "预案id"),
            @Parameter(required = true, name = "level", description = "预案等级"),
    })
    public Result getReservePlanMnTeamByLevel(String infoId,String level) {
        return Result.content(drainReservePlanMnTeamService.getReservePlanMnTeamInfoList(infoId,level));
    }
}
